package com.fancy.learncenter.activity;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.TextView;

import com.fancy.learncenter.activity.base.BaseActivity;
import com.fancy.learncenter.adapter.YiGouTongAdapter;
import com.fancy.learncenter.bean.BaseDataBean;
import com.fancy.learncenter.bean.YgtMouldCodeDataBean;
import com.fancy.learncenter.net.HttpMehtod;
import com.fancy.learncenter.net.IdeaObserver;
import com.fancy.learncenter.view.PromptPopupWindow;
import com.superservice.lya.R;

import java.util.HashMap;
import java.util.Map;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class YgtMouldCodeActivity extends BaseActivity {


    @Bind(R.id.mould_code)
    TextView mouldCode;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mould_code, getResources().getColor(R.color.toolbar_color));
        ButterKnife.bind(this);
        initToolbar("我的同步模板码");
        createCode();
    }


    private void createCode() {
        Map map = new HashMap();
        HttpMehtod.getInstance().createCode(map, new IdeaObserver<BaseDataBean<YgtMouldCodeDataBean>>(this, true) {


            @Override
            public void onSuccess(BaseDataBean<YgtMouldCodeDataBean> ygtMouldCodeDataBeanBaseDataBean) {

                if (ygtMouldCodeDataBeanBaseDataBean.getData() == null || TextUtils.isEmpty(ygtMouldCodeDataBeanBaseDataBean.getData().getCode() + "")) {
                    mouldCode.setText("退出页面请重新获取模板码");
                } else {
                    mouldCode.setText(ygtMouldCodeDataBeanBaseDataBean.getData().getCode() + "");
                }

            }

            @Override
            public void onFail(int errorCode) {

            }
        });
    }

}
